home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / magazine / executive_v2.00 / data / developers.lzx / SysInfo / include / libraries / SysInfo.h
C/C++ Source or Header  |  2002-10-11  |  7KB  |  239 lines

  1. #ifndef LIBRARIES_SYSINFO_H
  2. #define LIBRARIES_SYSINFO_H
  3.  
  4. /*
  5. **      $VER: SysInfo.h 2.00 (20.10.96)
  6. **      SysInfo Release 2.00
  7. **
  8. **      SysInfo.library definitions
  9. **
  10. **      This file is public domain.
  11. **
  12. **      Author: Petri Nordlund <petrin@megabaud.fi>
  13. **
  14. **      $Id: SysInfo.h 1.5 1996/10/01 23:03:07 petrin Exp petrin $
  15. **
  16. */
  17.  
  18. #ifndef EXEC_TYPES_H
  19. #include "exec/types.h"
  20. #endif /* EXEC_TYPES_H */
  21.  
  22. #ifndef EXEC_PORTS_H
  23. #include "exec/ports.h"
  24. #endif /* EXEC_PORTS_H */
  25.  
  26.  
  27. #define SYSINFONAME    "SysInfo.library"
  28. #define SYSINFOVERSION    2L
  29.  
  30.  
  31. /*
  32.  * This structure is returned by InitSysInfo() and it's READ-ONLY.
  33.  *
  34.  * NOTE!! This structure will grow in the future, so don't make any
  35.  * assumptions about it's length.
  36.  *
  37.  */
  38.  
  39. struct SysInfo {
  40. /* general */
  41.     LONG    errno;            /* Used to hold error values         */
  42.                     /* from some functions            */
  43. /* load average */
  44.     UWORD    loadavg_type;        /* load average type, see below        */
  45.     UWORD    loadavg_time1;        /* Usually 1, 5 and 15 minutes.        */
  46.     UWORD    loadavg_time2;        /* These times are in seconds.        */
  47.     UWORD    loadavg_time3;        /* 0 = time not implemented        */
  48.     UWORD    fscale;            /* scale value, if lavgtype = FIXED    */
  49.  
  50. /* id */
  51.     BOOL    GetPpid_implemented;    /* TRUE if GetPpid is implemented    */
  52.     BOOL    GetPgrp_implemented;    /* TRUE if GetPgrp is implemented    */
  53.  
  54. /* get/setnice */
  55.     UWORD    which_implemented;    /* Search methods for Get/SetNice    */
  56.     WORD    nicemin;        /* Nice-value giving most cpu time    */
  57.     WORD    nicemax;        /* Nice-value giving least cpu time    */
  58.  
  59. /* notify */
  60.     BOOL    notify_sig_implemented;    /* Notify by signal implemented        */
  61.     BOOL    notify_msg_implemented;    /* Notify by message implemented    */
  62.  
  63. /* cpu usage */
  64.     UWORD    cpu_usage_implemented;    /* What cpu usage values are implemented */
  65.  
  66. /* task cpu usage */
  67.     UWORD    task_cpu_usage_implemented;/* What cpu usage values are implemented */
  68.  
  69.     LONG    reserved[8];        /* Reserved for future use        */
  70. };
  71.  
  72.  
  73. /*
  74.  * general
  75.  *
  76.  */
  77.  
  78. /* errno values */
  79. #define    WHICH_EPERM    1        /* Operation not permitted    */
  80. #define    WHICH_ESRCH    3        /* No such process        */
  81. #define    WHICH_EACCES    13        /* Permission denied        */
  82. #define    WHICH_EINVAL    22        /* Invalid argument        */
  83.  
  84.  
  85. /*
  86.  * load average
  87.  *
  88.  */
  89.  
  90. /* LoadAverage type */
  91. #define LOADAVG_NONE        0    /* Load averages not implemented    */
  92. #define LOADAVG_FIXEDPNT    1    /* Load * SysInfo->fscale        */
  93.  
  94. /* GetLoadAverage */
  95. struct SI_LoadAverageFixed {
  96.     ULONG    load1;
  97.     ULONG    load2;
  98.     ULONG    load3;
  99. };
  100.  
  101. /* This is needed when calling GetLoadAverage() */
  102. struct SI_LoadAverage {
  103.     struct SI_LoadAverageFixed    lavg_fixed;
  104.     LONG                reserved[3];    /* Reserved for future use */
  105. };
  106.  
  107. /*
  108.  * get/setnice
  109.  *
  110.  */
  111.  
  112. /* Possible search methods for Get/SetNice */
  113. #define WHICH_PRIO_PROCESS    0
  114. #define WHICH_PRIO_PGRP        1
  115. #define WHICH_PRIO_USER        2
  116. #define WHICH_PRIO_TASK        3
  117.  
  118. /* These bits are used in which_implemented-field */
  119. #define WHICHB_PRIO_PROCESS    0
  120. #define WHICHB_PRIO_PGRP    1
  121. #define WHICHB_PRIO_USER    2
  122. #define WHICHB_PRIO_TASK    3
  123.  
  124. #define WHICHF_PRIO_PROCESS    (1L<<0)
  125. #define WHICHF_PRIO_PGRP    (1L<<1)
  126. #define WHICHF_PRIO_USER    (1L<<2)
  127. #define WHICHF_PRIO_TASK    (1L<<3)
  128.  
  129.  
  130. /*
  131.  * notify
  132.  *
  133.  */
  134.  
  135. /* This is needed when adding a notify-request. This may grow in future */
  136. struct SI_Notify {
  137.     struct MsgPort    *notify_port;    /* Message port for notify-messages    */
  138.     WORD        signal;        /* Signal NUMBER if you use signals    */
  139.     LONG        reserved[2];    /* Reserved for future use        */
  140. };
  141.  
  142. /* Flags for AddNotify () */
  143. #define AN_USE_MESSAGES (1<<0)
  144.  
  145.  
  146. /*
  147.  * cpu usage
  148.  *
  149.  */
  150.  
  151. /* This is needed when querying cpu usage */
  152. struct SI_CpuUsage {
  153.     ULONG    total_used_cputime;    /* Total used cputime in seconds    */
  154.     ULONG    total_elapsed_time;    /* Total used+idle cputime in seconds    */
  155.  
  156.     ULONG    used_cputime_lastsec;    /* Used cputime during last second    */
  157.     ULONG    used_cputime_lastsec_hz;/* 100 * lastsec / lastsec_hz = CPU %    */
  158.  
  159.     ULONG    recent_used_cputime;    /* Recently used cputime        */
  160.     ULONG    recent_used_cputime_hz;    /* 100 * recent / hz = RECENT CPU %    */
  161.     UWORD    recent_seconds;        /* "recent" means this many seconds    */
  162.  
  163.     ULONG    involuntary_csw;    /* Involuntary context switches     */
  164.     ULONG    voluntary_csw;        /* Voluntary context switches        */
  165.     ULONG    total_csw;        /* Total # of context switches        */
  166.  
  167.     ULONG    involuntary_csw_lastsec;/* Involuntary csws during last second  */
  168.     ULONG    voluntary_csw_lastsec;    /* Voluntary csws during last second    */
  169.     ULONG    total_csw_lastsec;    /* Total # of csws during last second    */
  170.  
  171.     LONG    reserved[12];        /* Reserved for future use        */
  172. };
  173.  
  174. /* These bits are used in cpu_usage_implemented-field */
  175. #define CPU_USAGEB_TOTAL_IMPLEMENTED        0
  176. #define CPU_USAGEB_LASTSEC_IMPLEMENTED        1
  177. #define CPU_USAGEB_RECENT_IMPLEMENTED        2
  178. #define CPU_USAGEB_IVVOCSW_IMPLEMENTED        3
  179. #define CPU_USAGEB_TOTALCSW_IMPLEMENTED        4
  180. #define CPU_USAGEB_IVVOCSW_LASTSEC_IMPLEMENTED    5
  181. #define CPU_USAGEB_TOTALCSW_LASTSEC_IMPLEMENTED    6
  182.  
  183. #define CPU_USAGEF_TOTAL_IMPLEMENTED        (1L<<0)
  184. #define CPU_USAGEF_LASTSEC_IMPLEMENTED        (1L<<1)
  185. #define CPU_USAGEF_RECENT_IMPLEMENTED        (1L<<2)
  186. #define CPU_USAGEF_IVVOCSW_IMPLEMENTED        (1L<<3)
  187. #define CPU_USAGEF_TOTALCSW_IMPLEMENTED        (1L<<4)
  188. #define CPU_USAGEF_IVVOCSW_LASTSEC_IMPLEMENTED    (1L<<5)
  189. #define CPU_USAGEF_TOTALCSW_LASTSEC_IMPLEMENTED    (1L<<6)
  190.  
  191.  
  192. /*
  193.  * task cpu usage
  194.  *
  195.  */
  196.  
  197. /* This is needed when querying cpu usage of a task */
  198. struct SI_TaskCpuUsage {
  199.     ULONG    total_used_cputime;    /* Total used cputime              */
  200.     ULONG    total_used_time_hz;    /* used_cputime / hz = cputime in secs    */
  201.     ULONG    total_elapsed_time;    /* Total used+idle cputime in seconds   */
  202.  
  203.     ULONG    used_cputime_lastsec;    /* Used cputime during last second    */
  204.     ULONG    used_cputime_lastsec_hz;/* 100 * lastsec / lastsec_hz = CPU %    */
  205.  
  206.     ULONG    recent_used_cputime;    /* Recently used cputime        */
  207.     ULONG    recent_used_cputime_hz;    /* 100 * recent / hz = RECENT CPU %    */
  208.     UWORD    recent_seconds;        /* "recent" means this many seconds    */
  209.  
  210.     ULONG    involuntary_csw;    /* Involuntary context switches     */
  211.     ULONG    voluntary_csw;        /* Voluntary context switches        */
  212.     ULONG    total_csw;        /* Total # of context switches        */
  213.  
  214.     ULONG    involuntary_csw_lastsec;/* Involuntary csws during last second    */
  215.     ULONG    voluntary_csw_lastsec;    /* Voluntary csws during last second    */
  216.     ULONG    total_csw_lastsec;    /* Total # of csws during last second    */
  217.  
  218.     LONG    reserved[8];        /* Reserved for future use        */
  219. };
  220.  
  221. /* These bits are used in cpu_usage_implemented-field */
  222. #define TASK_CPU_USAGEB_TOTAL_IMPLEMENTED        0
  223. #define TASK_CPU_USAGEB_LASTSEC_IMPLEMENTED        1
  224. #define TASK_CPU_USAGEB_RECENT_IMPLEMENTED        2
  225. #define TASK_CPU_USAGEB_IVVOCSW_IMPLEMENTED        3
  226. #define TASK_CPU_USAGEB_TOTALCSW_IMPLEMENTED        4
  227. #define TASK_CPU_USAGEB_IVVOCSW_LASTSEC_IMPLEMENTED    5
  228. #define TASK_CPU_USAGEB_TOTALCSW_LASTSEC_IMPLEMENTED    6
  229.  
  230. #define TASK_CPU_USAGEF_TOTAL_IMPLEMENTED        (1L<<0)
  231. #define TASK_CPU_USAGEF_LASTSEC_IMPLEMENTED        (1L<<1)
  232. #define TASK_CPU_USAGEF_RECENT_IMPLEMENTED        (1L<<2)
  233. #define TASK_CPU_USAGEF_IVVOCSW_IMPLEMENTED        (1L<<3)
  234. #define TASK_CPU_USAGEF_TOTALCSW_IMPLEMENTED        (1L<<4)
  235. #define TASK_CPU_USAGEF_IVVOCSW_LASTSEC_IMPLEMENTED    (1L<<5)
  236. #define TASK_CPU_USAGEF_TOTALCSW_LASTSEC_IMPLEMENTED    (1L<<6)
  237.  
  238. #endif /* LIBRARIES_SYSINFO_H */
  239.